/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import stendcontrol.SensorInformer;

/**
 *
 * @author minaev
 */
public class Spaning implements Runnable {

    JSlidePlotter spans[];
    int indx[];
    SensorInformer si;

    public Spaning(SensorInformer si,JSlidePlotter[] spans, int[] indx) {
        this.spans = spans;
        this.indx = indx;
        this.si = si;
    }
    boolean stop = false;

    public void stopSpan() {
        stop = true;
    }

    @Override
    public void run() {
        for (int i = 0; i < spans.length; i++) {
            spans[i].addValue(4096);
        }

        while (!stop) {
            for (int i = 0; i < spans.length; i++) {
                spans[i].addValue(si.getScaleSensor(indx[i]));
            }
            try {
                Thread.sleep(10);
            } catch (InterruptedException ex) {
            }
        }
    }
};
